package org.phalanx.client.UI;

import java.util.Hashtable;

import javax.swing.JDialog;
import javax.swing.JFrame;

public class DialogManager {
	private static DialogManager d;
	private Hashtable<String,JFrame> windowTable = new Hashtable<String,JFrame>();
	
	synchronized public static DialogManager getInstance(){
		if (d == null){
			d = new DialogManager();
		}
		return d;
	}
	
	public JFrame getDialog(String frameName){
		JFrame storedFrame = null;
		
		if (windowTable.containsKey(frameName)){
			storedFrame = windowTable.get(frameName);
		}
		return storedFrame;
	}
	
	public void removeDialog(String frameName){
		if (frameName != null){
			if (windowTable.containsKey(frameName)){
				windowTable.remove(frameName);
			}
		}
	}
	
	public void setDialog(String frameName, JFrame frame){
		if (frameName != null && frame != null){
			windowTable.put(frameName, frame);
		}
	}
	
	public JDialog getPopupDialog(String title, String message){
		JDialog popup = new JDialog();
		return popup;
	}
}
